package com.zjsru.plan2023.oneday;

/**
 * @Author: CookLee
 * @Date: 2023/5/17
 *  判断两个事件是否存在冲突
 *
 * 输入：event1 = ["10:00","11:00"], event2 = ["14:00","15:00"]
 * 输出：false
 * 解释：两个事件不存在交集。
 *
 * 输入：event1 = ["01:15","02:00"], event2 = ["02:00","03:00"]
 * 输出：true
 * 解释：两个事件在 2:00 出现交集。
 *
 *
 */
public class HaveConflict {
    public boolean haveConflict(String[] event1, String[] event2) {
        return !(event1[1].compareTo(event2[0]) < 0 || event2[1].compareTo(event1[0]) < 0);
    }
    
    public static void main(String[] args) {
        HaveConflict haveConflict = new HaveConflict();
        String[] event1 = new String[] {"10:00", "11:00"};
        String[] event2 = new String[] {"14:00", "15:00"};
        System.out.println(haveConflict.haveConflict(event1, event2));
    }
}
